package com.example.demo.thread;

import com.example.demo.thread.thread.TraditionalThread;

/**
 * @author: htc
 * @date: Created in 18:07 2019/1/2.
 */
public class TraditionalThreadCommunication {
    public static void main(String[] args) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 50; i++) {
                    synchronized (TraditionalThread.class) {
                        for (int j = 0; j < 10; j++) {
                            System.out.println("sub thread sequece of " + j + ", loop of " + i);
                        }
                    }
                }
            }
        }).start();

        for (int i = 0; i < 50; i++) {
            synchronized (TraditionalThread.class) {
                for (int j = 0; j < 10; j++) {
                    System.out.println("sub thread sequece of " + j + ", loop of " + i);
                }
            }
        }
    }
}
